package com.force.langchain4j.filesource;

import cn.hutool.core.io.resource.ClassPathResource;
import cn.hutool.core.thread.ThreadUtil;
import org.springframework.ai.document.Document;
import org.springframework.ai.transformer.splitter.TokenTextSplitter;

import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;

public class TestEntry {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        ClassPathResource classPathResource = new ClassPathResource("斗罗大陆.txt");
//        Future<Object> stringFuture = ThreadUtil.execAsync(() -> {
//
//            return load;
//        });
        Object load = FileBaseLoader.load(classPathResource.getAbsolutePath());

        // 文档分割
        TokenTextSplitter splitter = new TokenTextSplitter();
        List<Document> splitDocuments = splitter.apply((List<Document>) load);
        for (Document splitDocument : splitDocuments) {

        }
        System.out.println(load);
    }
}
